{% extends 'base.html' %}
{% block title %}Brisbane Coupon{% endblock %}
{% block stylesheet %}
{{ block.super }}
{% endblock%}

{% block javascript %}
{{ block.super }}
<script type="text/javascript">
$(document).ready(function(){
	/*
    $("body").click(function(event) {
        if ($(event.target).is(".couponBtn")) {
            var couponId = $(event.target).attr("id");
            {% if local_test %}
            var address = 'http://localhost:8000/coupon/sms/' + couponId;
            {% else %}
            var address = 'http://brisbanecoupon.com/coupon/sms/' + couponId;
            {% endif  %}
            
            tkstickyMsg("Sending....", "good");
            
            $.get(address, function(data){
                if(data.result.success == true) {
                    tkstickyMsg(data.result.msg, "good");
                } else {
                    tkstickyMsg(data.result.msg, "good");
                }
            }).complete(function(){
            });
            return false;
        }
    });
	*/
	$(".hidden").hide();
	$(".btn").click(function(){
	    var id = $(this).attr("id");
	    var showId = "#show-" + id.toString();
	    $(showId).toggle('slow');
	})
	
});
</script>
{% endblock%}

{% block content %}
<div id="dLayout">
  <div id="dSearch">
    <form method="get" action="">
    {{ search_form.q }}
    </form>
  </div> <!-- end dSearch-->
</div> <!-- end dLayout-->

<div id="dWrapper">
  <div id="dLineContent">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <thead>
        <tr>
          <th>Title</th>
          <th>Store</th>
          <th>Description</th>
          <th>By date</th> 
        </tr>
      </thead>
      <tbody>
      {% for recruit in objects_page.object_list %}
        <tr>
  	      <td>{{ recruit.name }}</td>
  	      <td><a href="{{ recruit.store.url }}">{{ recruit.store.name }}</a></td>
  	      <td><a class="btn" href="#" id="{{ recruit.id }}">{{ recruit.description|safe|truncatewords:7 }}</a></td>
  	      <td>{{ recruit.edate }}</td>
        </tr>
        <tr id="show-{{ recruit.id }}" class="hidden" style="display: table-row;">
          <td class="cHiddenBG" colspan="4">{{ recruit.description|safe }}</td>
        </tr>
      {% endfor %}
      </tbody>
    </table>
    {% include "paginator.html" %}
  </div>
</div> <!--dWrapper-->

    
{% endblock %}
